import time
from threading import Thread

def test1():
    while 1:
        time.sleep(1)
        print('Hello, World')

def test2(n):
    time.sleep(4)
    print(n)

t1 = Thread(target=test1)
t1.daemon = True        # 设置t1为守护线程
t1.start()
for i in range(3):
    t2 = Thread(target=test2, args=(i, ))
    t2.start()
print('==========================')     # 到这里，主线程代码执行完毕，守护线程没有结束